package com.hckj.medical.controller;


import com.hckj.medical.entity.Dictionary;
import com.hckj.medical.service.IDictionaryService;
import com.hckj.medical.utils.Code;
import com.hckj.medical.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author hckj
 * @since 2023-11-25
 */
@RestController
@RequestMapping("/medical/dictionary")
public class DictionaryController {
    @Autowired
    private IDictionaryService dictionaryService;
    @GetMapping("/findType/{id}")
    public R findBybid(@PathVariable Integer id){
        List<Dictionary> dictionaries = dictionaryService.selectByBlongId(id);
        if (!dictionaries.isEmpty()){
            return new R(Code.GET_OK,dictionaries,"查询成功");
        }else {
            return new R(Code.GET_ERRO,"查询失败");
        }
    }
}
